function inheritPrototype(SubType, SuperType) {
  SubType.prototype = Object.create(SuperType.prototype)
  Object.defineProperty(SubType.prototype, 'constructor', {
    enumerable: false,
    configurable: true,
    writable: true,
    value: SubType
  })
}




function Person(name, age, friends) {
  this.name = name
  this.age = age
  this.friends = friends
}

Person.prototype.running = function () {
  console.log(this.name + '~~running');
}
Person.prototype.eating = function () {
  console.log(this.name + '~~eating');
}

function Student(name, age, friends, sno, score) {
  Person.call(this, name, age, friends)
  this.sno = sno
  this.score = score
}

// 创建出来了一个新的对象,新的对象的原型(__proto__)指向Person.prototype
// Student.prototype = Object.create(Person.prototype)
// Object.defineProperty(Student.prototype, 'constructor', {
//   enumerable: false,
//   configurable: true,
//   writable: true,
//   value: Student
// })
inheritPrototype(Student, Person)

Student.prototype.studying = function () {
  console.log(this.name + '~studying');
}

var stu = new Student('why', 19, ['kobe'], 01, 100)
console.log(stu);
stu.running()
stu.eating()
stu.studying()
console.log(stu.constructor.name);